package com.zhou.spring.cloud.balancer.feign.transform;

/**
 * @author 18576666986
 * @description
 * @createDate 2022/7/22 11:53
 */

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;

public class NumericBooleanDeserializer extends JsonDeserializer<Boolean> {

    @Override
    public Boolean deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        return "1".equals(jp.getText()) ? true : false;
    }

}
